package cn.e3mall.test.solr.pojo;

import org.apache.solr.client.solrj.beans.Field;
import org.springframework.data.annotation.Id;
import org.springframework.data.solr.core.mapping.Indexed;
import org.springframework.data.solr.core.mapping.SolrDocument;

import java.io.Serializable;

@SolrDocument(solrCoreName = "collection1")
public class SearchItem implements Serializable {
    @Id
    @Indexed
    private String id;
    @Indexed("item_title")
    private String title;
    
    // @Indexed("item_desc")
    // private String desc;
    
    @Indexed("item_sell_point"   )
    private String sellPoint;
    
    public String getSellPoint() {
        return sellPoint;
    }
    
    public void setSellPoint(final String sellPoint) {
        this.sellPoint = sellPoint;
    }
    
    @Indexed("item_price")
    private long price;
    
    @Indexed("item_category_name")
    private String categoryName;
    
    public String getCategoryName() {
        return categoryName;
    }
    
    public void setCategoryName(final String categoryName) {
        this.categoryName = categoryName;
    }
    
    @Field("item_image")
    private String image;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }



    public long getPrice() {
        return price;
    }

    public void setPrice(long price) {
        this.price = price;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }


    public String[] getImages() {
        if (image != null && !"".equals(image)) {
            String[] strings = image.split(",");
            return strings;
        }
        return null;
    }
    
    @Override
    public String toString() {
        return "SearchItem{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", sell_point='" + sellPoint + '\'' +
                ", price=" + price +
                ", category_name='" + categoryName + '\'' +
                ", image='" + image + '\'' +
                '}';
    }
}
